package com.example.demo.test;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class test3 {

    public static void main(String[] args) {

        String str="{    \"code\": \"0\",    \"message\": \"成功\",    \"data\": {        \"111360\": {            \"attrId\": \"111360\",            \"time\": \"1659317933392\",            \"value\": \"36.0\"        },        \"111361\": {            \"attrId\": \"111361\",            \"time\": \"1659317933392\",            \"value\": \"36\"        },        \"111363\": {            \"attrId\": \"111363\",            \"time\": \"1659317933392\",            \"value\": \"36\"        }    }}";

        Map jsonObject = JSONObject.parseObject(str);
        System.out.println(jsonObject);

        Map data = (Map) jsonObject.get("data");
        System.out.println(jsonObject.get("data"));

        Map<String,String> o = (Map) data.get("111363");
        System.out.println(data.get("111363"));

        String value = o.get("value");
        System.out.println(o.get("value"));

        System.out.println(BigDecimal.valueOf(Double.parseDouble(value)));


        ArrayList<Integer> list = new ArrayList<>();

        list.add(1);
        list.add(2);
        list.add(1);
        list.add(3);
        List<Integer> collect = list.stream().filter(attr -> attr == 1).collect(Collectors.toList());
        System.out.println(collect);


    }
}
